import { Controller, Get, Param } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { KeyValueStore } from '../keyValueStore/assets/keyValueStore.entity';
import { KeyValueStore_Service } from '../keyValueStore/keyValueStore.service';
import { IConstant_Enum_Type_KeyValueStore_Enum_TypeKey } from '@/common/constants/enum';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/web/keyValueStoreWeb')
@ApiTags('keyValueStoreWeb 键值对')
export class KeyValueStoreWeb_Controller {
  constructor(private readonly keyValueStore_Service: KeyValueStore_Service) {}

  @Get('/storeKey/:storeKey')
  @util_ApiResponse_Base({
    dataType: 'dataType_ell',
    summary: '根据键获取详情',
    //apiKey: '/web/keyValueStoreWeb/storeKey/:storeKey Get',
    noAuth: true,
  })
  async keyValueStore_FindOneByStoreKey(
    @Param('storeKey')
    storeKey: IConstant_Enum_Type_KeyValueStore_Enum_TypeKey,
  ) {
    return util_Index_ReturnContent<KeyValueStore>(
      await this.keyValueStore_Service.keyValueStore_FindOneByStoreKey(storeKey),
    );
  }
}
